﻿package chapter_04_Homework;

public class Work_09_Dog extends Work_09_Pet {
	private String strain;
	/**
	 * 有参构造方法
	 * @param name 昵称
	 * @param strain 品种
	 */
	public Work_09_Dog(String name,String strain) {
		super(name);
		this.strain=strain;
	}

	public String getStrain() {
		return strain;
	}
	/**
	 * 重写父类print方法
	 */
	public void print(){
		super.print();
		System.out.println("我是一只"+this.strain+".");
	}
	@Override
	public void eat() {
		// TODO Auto-generated method stub

		if(getHealth()>=100){
			System.out.println("狗狗"+this.getName()+"吃饱啦。");
		}else{
			this.setHealth(this.getHealth()+3);
			System.out.println("狗狗"+this.getName()+"吃饱啦！健康值+3");
		}
	}
	/**
	 * 实现接飞盘方法
	 */
	public void catchFlyDisc(){
		System.out.println("狗狗"+this.getName()+"正在接飞盘");
		this.setHealth(this.getHealth()-10);
		this.setLove(this.getLove()+5);
	}
}
